package com.share.homestay.web;

import com.share.homestay.entity.HostelOrders;
import com.share.homestay.entity.OrderOperationLogs;
import com.share.homestay.pojo.JsonResult;
import com.share.homestay.service.HostelOrdersServiceFeign;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "旅馆订单模块")
@RestController
@CrossOrigin
@RequestMapping("HostelOrders")
public class HostelOrdersController {
    @Autowired
    private HostelOrdersServiceFeign hostelOrdersServiceFeign;

    @RequestMapping("findAllHostelOrders")
    @ApiOperation(value = "分页查询全部订单",httpMethod = "POST",notes = "分页查询全部订单")
    private JsonResult findAllHostelOrders(@RequestBody HostelOrders hostelOrders, @RequestParam(value = "pageNum",defaultValue = "1")Long pageNum, @RequestParam(value = "pageSize",defaultValue = "100")Long pageSize){
        return hostelOrdersServiceFeign.findAllHostelOrders(hostelOrders,pageNum,pageSize);
    }

    @RequestMapping("findOrderOperationLogs")
    @ApiOperation(value = "分页查询订单操作日志",httpMethod = "POST",notes = "分页查询订单操作日志")
    private JsonResult findOrderOperationLogs(@RequestParam(value = "id") String id, @RequestParam(value = "pageNum",defaultValue = "1")Long pageNum, @RequestParam(value = "pageSize",defaultValue = "100")Long pageSize){
        return hostelOrdersServiceFeign.findOrderOperationLogs(id,pageNum,pageSize);
    }

    @RequestMapping("addOrderOperationLog")
    @ApiOperation(value = "添加订单操作日志",httpMethod = "POST",notes = "添加订单操作日志")
    private Long addOrderOperationLog(@RequestBody OrderOperationLogs orderOperationLogs){
        return hostelOrdersServiceFeign.addOrderOperationLog(orderOperationLogs);
    }
}
